#ifndef CLIENT_H
#define CLIENT_H

#include <assert.h>
#include <memory>
#include <queue>
#include <windows.h>

class Server;
class Message;
class GUIMessage;
class Army;
class Improvement;

enum MOUSEBUTTON { MLEFT, MRIGHT };

class Client{
    public:
        void Initialise(int clientID, bool human);
        void Update();

		int GLHeight;
        int GLWidth;

        int GetClientID(){ return clientID; }
        bool IsHuman(){ return human; }

		int mx, mdx;
		int my, mdy;
		int rot;

        void Click(int mbutton);

		void KeyDown(int key, bool down);

		void MouseMoved();
        void SetMousePosition(int x, int y);

    private:
        void ProcessGUIMessage(GUIMessage* msg);

        void ProcessOrder(GUIMessage* message);

        void BeginPlacing(std::string name);
        void EndPlacing();
        void CancelPlacing();

        int clientID;

        bool mouseCaptured;
        int lastMouseButton;

        int prevTime;
        int diffTime;

        bool acceptingInput;
        bool turnDone;
        bool endingTurn;

        bool human;

        enum ClientState{
            AWAITING_ORDERS,
            PLACING
        } client_state;


        std::vector<int> cameraKeys;
};

extern Client* client;
#endif
